//
//  Request.h
//  NewsReader
//
//  Created by blacksun on 11-2-16.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol RequestDelegate

-(void) request:(id)aRequest successWithResult:(id)result andCommand:(int) aCommand;
-(void) request:(id)aRequest failedWithStatuCode:(int) aStatuCode andCommand:(int) aCommand;
@end



@interface Request : NSObject{
	NSString *urlStr;
	id<RequestDelegate> delegate;
	int command;
	
	NSURLConnection *currentConnection;
	NSMutableData *responseData;
}

@property (nonatomic,retain) id<RequestDelegate> delegate;
@property (nonatomic,retain) NSString* urlStr;
@property (nonatomic,assign) int command;
@property (nonatomic,retain) NSURLConnection *currentConnection;
@property (nonatomic,retain) NSMutableData *responseData;

-(id)initWithURLStr:(NSString *)aUrlStr delegate:(id<RequestDelegate>) aDelegate andCommand:(int)aCommand;
-(void)start;
-(void)cancel;
@end
